//sub_eg.cpp
#include "ros/ros.h"
#include <sensor_msgs/Imu.h>
#include "std_msgs/String.h"
#include "sensor_msgs/NavSatFix.h"
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
    ROS_INFO("I heard: [%s]", msg->data.c_str());
}

void ImuCallback(const sensor_msgs::Imu::ConstPtr& msg)
{

    ROS_INFO("I heard: [%d] [%f] [%f] [%f] [%f]",msg->header.stamp.toSec(),msg->angular_velocity.x,msg->angular_velocity.y,msg->angular_velocity.z);
    
}
void gpsCallback(const sensor_msgs::NavSatFix::ConstPtr& msg)
{
 
    ROS_INFO("I heard: [%d] [%f] [%f] [%f] [%f]",msg->header.stamp.toSec(),msg->altitude,msg->longitude,msg->latitude);
    
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "listener");
    ros::NodeHandle n("~");
    std::cout<<"subcriber"<<std::endl;

    ros::Subscriber imusub = n.subscribe("/publisher/imu_data", 10, ImuCallback);
    ros::Subscriber gpssub = n.subscribe("/publisher/gps_data", 10, gpsCallback);
    ros::spin();

    return 0;
}
